package com.qianya.oa.constant;


import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;

public enum FormEnum {

    /**
     * formKey 以及 表名称（前端根据不同formKey渲染不同表单）
     */
    OUTSIDE_PLAN("outside_plan", "出差计划表"),
    OUTSIDE_APPLY("outside_apply", "出差申请表"),
    DEALER_BASE_INFO("dealer_base_info", "经销商基本信息表"),
    DEALER_EVALUATION("dealer_evaluation", "经销商评估表"),
    CHANNEL_BASE_INFO("channel_base_info", "渠道基本信息表"),
    PROJECT_SCHEDULE("project_schedule", "客观分析项目进度表"),
    HOSPITAL_INFO("hospital_info", "医院基本信息表"),
    REGIONAL_HOSPITAL("regional_hospital", "地区医院基本信息表");

    private String formKey;
    private String formName;

    FormEnum() {
    }

    FormEnum(String formKey, String formName) {
        this.formKey = formKey;
        this.formName = formName;
    }

    public String getFormKey() {
        return this.formKey;
    }

    public String getFormName() {
        return this.formName;
    }

    /**
     * 获取集合Map
     *
     * @return
     */
    public static HashMap<String, String> getMap() {
        HashMap<String, String> map = new HashMap<>();
        for (FormEnum formEnum : EnumSet.allOf(FormEnum.class)) {
            map.put(formEnum.formKey, formEnum.formName);
        }
        return map;
    }

    /**
     * 获取集合List
     *
     * @return
     */
    public static List<HashMap<String, String>> getList() {
        List<HashMap<String, String>> list = new ArrayList<>();
        for (FormEnum formEnum : EnumSet.allOf(FormEnum.class)) {
            HashMap<String, String> map = new HashMap<>();
            map.put("formKey", formEnum.formKey.toString());
            map.put("formName", formEnum.formName);
            list.add(map);
        }
        return list;
    }

}
